package com.lai.qq.admin.biz.controller;


import com.alibaba.fastjson.JSON;
import com.lai.qq.admin.biz.req.AutoDmsInfoReq;
import com.lai.qq.admin.biz.res.RebackInfoResult;
import com.byd.dilink.api.common.service.RocketMqProducerService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("/api/admin/vehicle")
@RestController
@Api(tags = "车辆模块")
public class AutoVehicleController {

    @Reference
    private RocketMqProducerService rocketMqProducerService;

    @Value(value = "${rocketMq.topic.transferOwnership}")
    private String transferOwnership;


    /**
     * 过户发消息，自动过户
     * @param req
     * @return
     * @throws Exception
     */
    @PostMapping("/transferOwnership")
    public RebackInfoResult selectAutoStyle(@RequestBody AutoDmsInfoReq req) throws Exception {
        log.info("/admin/vehicle/transferOwnership,req={}", JSON.toJSONString(req));
        rocketMqProducerService.sendOneway(null,transferOwnership,null,req);
        return new RebackInfoResult().success();
    }

}
